<%-- 
    Document   : ProcessColleges
    Created on : Nov 17, 2013, 5:28:51 PM
    Author     : smarzoug
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
    <%@ page import="com.dts.uas.model.*"%>
  <%@ page import="com.dts.uas.dao.*"%>
  <%@ page import="com.dts.core.util.*" %>
  <%@ page import="java.util.*" %>	
 
   <%
   if(request.getParameter("AddColleges")!=null)
   {
   
   String target="/CheckCollege.jsp?status=Colleges Inserting Failed "; 
   String city=request.getParameter("city");
   String collegename=request.getParameter("collegename");
   String university=request.getParameter("university");
   String state=request.getParameter("state");
   String country=request.getParameter("country");
   College acollege=new College();
   acollege.setCity(city);
 acollege.setCollegename(collegename);
 acollege.setUniversity(university);
 acollege.setState(state);
 acollege.setCountry(country);
 CollegesDAO acollegesdao=new CollegesDAO();
 boolean flag=acollegesdao.addColleges(acollege);
    if(flag)
    {
    target="/CheckCollege.jsp?status=Colleges Inserting Successful";
    }
    RequestDispatcher rd=request.getRequestDispatcher(target);
    rd.forward(request,response);
   } %>
   
   <% 
   if(request.getParameter("DeleteColleges")!=null)
   {
   
   String target="/CheckCollege.jsp?status=Colleges Regesitration Canceled Failed "; 
   String city=request.getParameter("city");
   String collegename=request.getParameter("collegename");
   String University=request.getParameter("university");
   College acollege=new College();
   acollege.setCity(city);
 acollege.setCollegename(collegename);
 acollege.setUniversity(University);
 CollegesDAO acollegesdao=new CollegesDAO();
 boolean flag=acollegesdao.deleteColleges(acollege);
    if(flag)
    {
    target="/CheckCollege.jsp?status=Colleges Regesitration Canceled Successful";
    }
    RequestDispatcher rd=request.getRequestDispatcher(target);
    rd.forward(request,response);
   } %>
   
   
  </body>
</html>
